package com.wenbai.servicelightluxurystickers.controller;

import com.wenbai.servicelightluxurystickers.entity.StickForumMember;
import com.wenbai.servicelightluxurystickers.service.StickForumMemberService;
import com.wenbai.servicelightluxurystickers.utils.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/stick/member")
public class StickForumMemberController {
    @Autowired
    private StickForumMemberService stickForumMemberService;

    @GetMapping("/selectMemberById")
    public Response<List<StickForumMember>> selectMemberById(String id){
        if("undefined".equals(id)){
            id = null;
        }
        List<StickForumMember> stickForumMembers = stickForumMemberService.selectMember(id);
        return Response.success(stickForumMembers);
    }

    @PostMapping("/updateManage")
    public Response<String> updateManage(@RequestParam int userId, @RequestParam int forumId){
        stickForumMemberService.updateManage(userId, forumId);
        return Response.success("转让成功");
    }

    @GetMapping("/selectMemberByUserId")
    public Response<List<StickForumMember>> selectMemberByUserId(int userId){
        List<StickForumMember> stickForumMembers = stickForumMemberService.selectMemberByUserId(userId);
        return Response.success(stickForumMembers);
    }
}
